<?php

define('SMIT_START_TIME', microtime(true));

//----------------------------------------------------------
//	SMIT_PATH - Installation directory [AUTO]
//	IMPORT_PATH - Why do you want to change this?
//	SMIT_SYS_PATH - Sources Path [CHANGABLE]
//	SMIT_CP_PATH - Dashboard Path [CHANGABLE]
//	EXT - PHP File extension [AUTO]
//----------------------------------------------------------
define('SMIT_PATH', str_replace('\\', '/', realpath('../../')) . '/');
define('IMPORT_PATH', str_replace('\\', '/', dirname(__FILE__)) . '/importers/');
define('SMIT_SYS_PATH', SMIT_PATH . 'sources/');
define('SMIT_CP_PATH', SMIT_PATH . 'admincp/');
define('EXT', '.' . pathinfo(__FILE__, PATHINFO_EXTENSION));

//----------------------------------------------------------
// Define Smit Constants
//----------------------------------------------------------
define('E_SMIT', 1);
define('E_MISSING_FILE', 2);
define('E_DATABASE', 3);
define('E_CLASS_MISMATCH', 4);

define('SMIT_DEBUG', 1);
define('SMIT_DEBUG_LOG', 1);

@set_magic_quotes_runtime(0);

error_reporting(E_ALL | E_NOTICE);

require_once SMIT_SYS_PATH . 'core/SmitBase' . EXT;

$Smit = SmitBase::getInstance();

$action = (isset($_GET['act']) ? $_GET['act'] : NULL);

// Master Importer
require_once './importMaster' . EXT;

$Smit->loadConfig(SMIT_PATH . 'root_config' . EXT, 'root');
$Smit->load('database');
$Smit->load('corelib');

$Smit->db->loadconfig();

$noload = array(NULL, 'setup', 'actions', 'review');
if(!in_array($action, $noload) && $Smit->lib->getcookie('import_source'))
{
	$importer = IMPORT_PATH . $Smit->lib->getcookie('import_source') . EXT;
	if(!file_exists($importer))
	{
		$Smit->error('Unknown Importer "' . $Smit->lib->getcookie('import_source') . '"', E_MISSING_FILE);
	}
	require_once $importer;
	
	$Importer = new importSlave;
}
else
{
	$Importer = new importMaster;
}

switch($action)
{
	default:
	break;
	case'setup':
	break;
}
?>